//
//  LRJDesFirCollectionViewCell.m
//  BreadTravel
//
//  Created by 李润嘉 on 15/12/25.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "LRJDesFirCollectionViewCell.h"

@implementation LRJDesFirCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}
- (void)createSubView
{
    self.contentView.layer.masksToBounds = YES;
    self.contentView.layer.cornerRadius = 10;
    
    self.myImageView = [[UIImageView alloc]initWithFrame:self.contentView.frame];
    self.myImageView.backgroundColor = [UIColor grayColor];
    self.myImageView.layer.masksToBounds = YES;
    self.myImageView.layer.cornerRadius = 10;
    [self.contentView addSubview:self.myImageView];
    
    UIImageView *overlayImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.myImageView.W, self.myImageView.H + 5)];
    overlayImage.image = [UIImage imageNamed:@"trip_edit_title_shadow.png"];
    overlayImage.layer.masksToBounds = YES;
    overlayImage.layer.cornerRadius = 10;
    [self.myImageView addSubview:overlayImage];
    
    
    self.myLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.myImageView.X + 15, self.myImageView.H - 50, self.myImageView.W - 15 , 20)];
    self.myLabel.textColor = [UIColor whiteColor];
    [self.myImageView addSubview:self.myLabel];
    
    self.enLabel = [[UILabel alloc] initWithFrame:CGRectMake(_myLabel.X, _myLabel.Y + 25, _myLabel.W, 20)];
    self.enLabel.textColor = [UIColor whiteColor];
    self.enLabel.font = [UIFont systemFontOfSize:12];
    [self.myImageView addSubview:self.enLabel];
    
}

- (void)setDataModel:(LRJDesFirDataModel *)dataModel
{
    NSURL *url = [NSURL URLWithString:dataModel.cover];
    [self.myImageView sd_setImageWithURL:url placeholderImage:IMAGE];
    
    self.myLabel.text = dataModel.name_orig;
    self.enLabel.text = dataModel.name;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
